package com.example.simplemodule;

import android.os.Bundle;
import android.view.View;
import android.widget.RadioGroup;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class RadioGroupTestActivity extends AppCompatActivity implements View.OnClickListener {
	private RadioGroup radioGroup;
	@Override
	protected void onCreate( Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_radiogroup);
		radioGroup=findViewById(R.id.radio_group);
		radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
			if(checkedId==R.id.radio_button_man){
				Toast.makeText(RadioGroupTestActivity.this, "您选中了男", Toast.LENGTH_SHORT).show();
			}else if (checkedId==R.id.radio_button_woman){
				Toast.makeText(RadioGroupTestActivity.this, "您选中了女", Toast.LENGTH_SHORT).show();
			}
		});
	}

	@Override
	public void onClick(View v) {
		
	}
}
